package network;

import javax.swing.SwingWorker;

public class TransportTask extends SwingWorker<Integer, Integer> {
	  private static int DELAY = 1000;
	  
	  public TransportTask() {
	  }

	  @Override
	  protected Integer doInBackground() throws Exception {
		DELAY = 100;
		int count = 100;
		int i     = 0;
		try {
		    while (i < count) {
		        i++;
		        setProgress(i);
			Thread.sleep(DELAY);
		    }
		} catch (InterruptedException e) {
		  //  e.printStackTrace();
		}
		return 0;
	  }
	   

	  @Override
	  protected void done() {
	    if (isCancelled()) {
	    	// TODO: CANCELED TASK
	    }
	    else {
	    	// TODO: TASK IS DONE
	    }
	  }
	}